<template>
    <div>
        <v-file-input
                ref="input"
                label="选择文件"
                @change="uploadFile"
        ></v-file-input>
    </div>
</template>

<script>
export default {
    name: "TestView",
    methods: {
        uploadFile() {
            const file = this.refs.input.files[0]
            const formData = new FormData()
            formData.append('file', file)

            this.axios.post('/upload', formData)
                .then(response => {
                    console.log(response.data)
                })
                .catch(error => {
                    console.error(error)
                })
        }
    }
}
</script>

<style scoped>

</style>
